﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBeamLibrary.Types;
using JBeamLibrary.VehicleParts.Elements;

namespace JBeamLibrary.VehicleParts.Enums
{
    public static class ElementPropertyTypes
    {
        public static readonly Dictionary<ElementProperties, Type> TypeMap = new Dictionary<ElementProperties, Type>
        {
            /* Beam related */
            { ElementProperties.BeamType, typeof(BeamType) },
            { ElementProperties.BeamSpring, typeof(int) },
            { ElementProperties.BeamDamp, typeof(int) },
            { ElementProperties.BeamDeform, typeof(int) },
            { ElementProperties.BeamStrength, typeof(int) },
            { ElementProperties.BeamPrecompression, typeof(float) },
            { ElementProperties.BeamLongBound, typeof(float) },
            { ElementProperties.BeamShortBound, typeof(float) },
            { ElementProperties.BeamLimitSpring, typeof(int) },
            { ElementProperties.BeamLimitDamp, typeof(int) },
            { ElementProperties.BeamDampRebound, typeof(float) },
            { ElementProperties.BeamDampFast, typeof(float) },
            { ElementProperties.BeamDampReboundFast, typeof(float) },
            { ElementProperties.BeamDampVelocitySplit, typeof(float) },

            /* Node related */
            { ElementProperties.NodeWeight, typeof(float) },
            { ElementProperties.NodeMaterial, typeof(NodeMaterial) },

            /* Flexbodies related */
            { ElementProperties.DisableSection, typeof(DefaultBoolean) },
            { ElementProperties.DebugPositioning, typeof(DefaultBoolean) },
            { ElementProperties.IsCollisionMesh, typeof(DefaultBoolean) },
            { ElementProperties.Rotation, typeof(Float3) },
            { ElementProperties.Translation, typeof(Float3) },

            /* Hub wheels related */
            { ElementProperties.EnableTireSideSupportBeams, typeof(DefaultBoolean) },
            { ElementProperties.Radius, typeof(float) },
            { ElementProperties.WheelOffset, typeof(float) },
            { ElementProperties.TireWidth, typeof(float) },
            { ElementProperties.NumRays, typeof(int) },
            { ElementProperties.AxleBeams, typeof(AxleBeams) },
            { ElementProperties.Propulsed, typeof(float) },
            { ElementProperties.EnableABS, typeof(DefaultBoolean) },
            { ElementProperties.AbsThreshold, typeof(int) },
            { ElementProperties.PressurePSI, typeof(int) },
            { ElementProperties.MaxPressurePSI, typeof(int) },
            { ElementProperties.ReinforcementPressurePSI, typeof(int) },
            { ElementProperties.PressureSpring, typeof(int) },
            { ElementProperties.ReinforcementPressureSpring, typeof(int) },
            { ElementProperties.PressureDamp, typeof(int) },
            { ElementProperties.ReinforcementPressureDamp, typeof(int) },
            { ElementProperties.BrakeTorque, typeof(int) },
            { ElementProperties.ParkingTorque, typeof(int) },
            { ElementProperties.Speedo, typeof(DefaultBoolean) },
            { ElementProperties.EnableTireSideVBeams, typeof(DefaultBoolean) },

            /* Hub related */
            { ElementProperties.HubRadius, typeof(float) },
            { ElementProperties.HubWidth, typeof(float) },
            { ElementProperties.HubBeamSpring, typeof(int) },
            { ElementProperties.HubBeamDamp, typeof(int) },
            { ElementProperties.HubBeamDeform, typeof(int) },
            { ElementProperties.HubBeamStrength, typeof(int) },
            { ElementProperties.HubNodeWeight, typeof(float) },
            { ElementProperties.HubNodeMaterial, typeof(NodeMaterial) },
            { ElementProperties.HubFrictionCoef, typeof(float) },

            /* Wheel tread & periphery & side */
            { ElementProperties.WheelTreadBeamSpring, typeof(int) },
            { ElementProperties.WheelTreadBeamDamp, typeof(int) },
            { ElementProperties.WheelTreadBeamDeform, typeof(int) },
            { ElementProperties.WheelTreadBeamStrength, typeof(int) },
            { ElementProperties.WheelPeripheryBeamSpring, typeof(int) },
            { ElementProperties.WheelPeripheryBeamDamp, typeof(int) },
            { ElementProperties.WheelPeripheryBeamDeform, typeof(int) },
            { ElementProperties.WheelPeripheryBeamStrength, typeof(int) },
            { ElementProperties.WheelSideBeamSpring, typeof(int) },
            { ElementProperties.WheelSideBeamDamp, typeof(int) },
            { ElementProperties.WheelSideBeamDeform, typeof(int) },
            { ElementProperties.WheelSideBeamStrength, typeof(int) },
            { ElementProperties.WheelSideBeamSpringExpansion, typeof(int) },
            { ElementProperties.WheelSideBeamDampExpansion, typeof(int) },

            /* Hubcap */
            { ElementProperties.EnableHubcaps, typeof(DefaultBoolean) },
            { ElementProperties.HubcapSelfCollision, typeof(DefaultBoolean) },
            { ElementProperties.HubcapCollision, typeof(DefaultBoolean) },
            { ElementProperties.HubcapWidth, typeof(float) },
            { ElementProperties.HubcapOffset, typeof(float) },
            { ElementProperties.HubcapBeamSpring, typeof(int) },
            { ElementProperties.HubcapBeamDamp, typeof(int) },
            { ElementProperties.HubcapBeamDeform, typeof(int) },
            { ElementProperties.HubcapBeamStrength, typeof(int) },
            { ElementProperties.HubcapAttachBeamSpring, typeof(int) },
            { ElementProperties.HubcapAttachBeamDamp, typeof(int) },
            { ElementProperties.HubcapAttachBeamDeform, typeof(int) },
            { ElementProperties.HubcapAttachBeamStrength, typeof(int) },
            { ElementProperties.HubcapNodeWeight, typeof(float) },
            { ElementProperties.HubcapCenterNodeWeight, typeof(float) },
            { ElementProperties.HubcapNodeMaterial, typeof(NodeMaterial) },
            { ElementProperties.HubcapFrictionCoef, typeof(float) },
            { ElementProperties.HubcapGroup, typeof(string) },
            { ElementProperties.HubcapBreakGroup, typeof(string) },

            /* Grouping */
            { ElementProperties.Group, typeof(string) },
            { ElementProperties.BreakGroup, typeof(string) },
            { ElementProperties.BreakGroupType, typeof(int) },
            { ElementProperties.DeformGroup, typeof(string) },

            /* Global flags */
            { ElementProperties.Collision, typeof(DefaultBoolean) },
            { ElementProperties.SelfCollision, typeof(DefaultBoolean) },
            { ElementProperties.Optional, typeof(DefaultBoolean) },
            { ElementProperties.DisableMeshBreaking, typeof(DefaultBoolean) },

            /* Hydro related */
            { ElementProperties.Factor, typeof(float) },
            { ElementProperties.SteeringWheelLock, typeof(float) },
            { ElementProperties.LockDegrees, typeof(float) },
            { ElementProperties.InRate, typeof(float) },
            { ElementProperties.OutRate, typeof(float) },
            { ElementProperties.InLimit, typeof(float) },
            { ElementProperties.OutLimit, typeof(float) },
            { ElementProperties.InputCenter, typeof(float) },
            { ElementProperties.AutoCenterRate, typeof(float) },
            { ElementProperties.InputSource, typeof(string) },
            { ElementProperties.InputFactor, typeof(float) },

            /* Thruster related */
            { ElementProperties.ThrustLimit, typeof(int) },
            { ElementProperties.Control, typeof(string) },

            /* Light related */
            { ElementProperties.LightInnerAngle, typeof(float) },
            { ElementProperties.LightOuterAngle, typeof(float) },
            { ElementProperties.LightBrightness, typeof(float) },
            { ElementProperties.LightRange, typeof(float) },
            { ElementProperties.LightColor, typeof(Color) },
            { ElementProperties.LightAttenuation, typeof(Float3) },
            { ElementProperties.LightCastShadows, typeof(DefaultBoolean) },

            /* Other */
            { ElementProperties.Name, typeof(string) },
            { ElementProperties.FrictionCoef, typeof(float) },
            { ElementProperties.DragCoef, typeof(float) },
            { ElementProperties.RemoteCollisionThickness, typeof(float) },
            { ElementProperties.EngineGroup, typeof(string) },
            { ElementProperties.SpringExpansion, typeof(int) },
            { ElementProperties.DampExpansion, typeof(int) },
            { ElementProperties.Pressure, typeof(float) },
            { ElementProperties.Surface, typeof(float) },
            { ElementProperties.VolumeCoef, typeof(float) },
            { ElementProperties.MaxPressure, typeof(float) },
            { ElementProperties.DeformationTriggerRatio, typeof(float) },
            { ElementProperties.DeformMaterialBase, typeof(string) },
            { ElementProperties.DeformMaterialDamaged, typeof(string) }
        };

        public static readonly Dictionary<Type, object> NullValues = new Dictionary<Type, object>
        {
            { typeof(string), "NULL" },
            { typeof(int), int.MinValue },
            { typeof(long), long.MinValue },
            { typeof(float), float.MinValue },
            { typeof(double), double.MinValue },
            { typeof(decimal), decimal.MinValue },
            { typeof(BeamType), BeamType.Unspecified },
            { typeof(NodeMaterial), NodeMaterial.Unspecified },
            { typeof(AxleBeams), null },
            { typeof(Float3), Float3.Invalid },
            { typeof(Color), Color.Transparent },
            { typeof(bool), false },
            { typeof(DefaultBoolean), DefaultBoolean.Undetermined },
        };

        public static readonly Dictionary<Type, object> MaxValues = new Dictionary<Type, object>
        {
            { typeof(string), "MAX" },
            { typeof(int), int.MaxValue },
            { typeof(long), long.MaxValue },
            { typeof(float), float.MaxValue },
            { typeof(double), double.MaxValue },
            { typeof(decimal), decimal.MaxValue },
            { typeof(BeamType), BeamType.Normal },
            { typeof(NodeMaterial), NodeMaterial.Metal },
            { typeof(AxleBeams), null },
            { typeof(Float3), Float3.Origin },
            { typeof(Color), Color.White },
            { typeof(bool), true },
            { typeof(DefaultBoolean), DefaultBoolean.True },
        };
    }
}
